<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/9/12
 * Time: 10:27
 * 查询每个机构的上课总人数
 */

$oa_oseid = $route->bodyParams['oa_oseid'];  //机构ID
$startTime = $route->bodyParams['startTime'];
$endTime = $route->bodyParams['endTime'];

if($startTime&&$endTime){
    $time_condition = "AND (osc_start_time between ". $startTime ." AND " . $endTime .") OR (osc_end_time BETWEEN ".$startTime." AND ".$endTime.")";
}else{
    $time_condition = "";
}

$sql = "SELECT SUM(osc_official_student_count) as student_num FROM art_oa_school_class WHERE osc_oesid = ".$oa_oseid." ".$time_condition;

$re=$db->mysqlDB->query($sql);


$response->responseData(true, $re);